package com.hmdp.utils;

import com.hmdp.dto.UserDTO;
import com.hmdp.entity.User;

/**
 * @author 勋谦
 * @ClassName: ThreadLocalUtls
 * @date: 2024/12/18 15:59
 * @Description:
 */
public class ThreadLocalUtls {

    private static final ThreadLocal<User> tl = new ThreadLocal<>();

    public static void saveUser(User user){
        tl.set(user);
    }

    public static User getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
